package cn.gpdi.controller;

import cn.gpdi.framework.dao.CommDAO;
import cn.gpdi.framework.util.CommUtil;
import cn.gpdi.service.CommService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by 司徒鑫(QQ:156845600) on 2018/7/13.
 */
@Controller
public class CommController {

    int i=0;

    Logger logger = Logger.getLogger(CommController.class);

    @Autowired
    CommDAO commDAO;

    @Autowired
    CommService commService;

    @ResponseBody
    @RequestMapping(value = "/upload_img.do")
    //CKEDITOR 上传图片
    public Map uplodaImg(HttpServletRequest request) throws Exception {
        Map m=new HashMap();
        m.put("code",1);
        m.put("msg","");
        m.put("data",commService.uplodaFile(request));
        return m;
    }
}
